/**
 * Copyright 2025 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

:host {
    inset: 0;
    width: 100%;

    --sp-tabs-overflow-next-button-right: calc(-1 * var(--spectrum-component-edge-to-text-100));
    --sp-tabs-overflow-previous-button-left: calc(-1 * var(--spectrum-component-edge-to-text-100));
    --sp-tabs-overflow-button-height: calc(var(--spectrum-tab-item-height-medium) - var(--spectrum-border-width-200));
    --sp-tabs-overflow-button-size: var(--spectrum-tab-item-height-medium);
    --sp-tabs-overflow-icon-color: var(--spectrum-gray-800);
    --sp-tabs-overflow-shadow-color: var(--spectrum-gray-100);
    --sp-tabs-overflow-shadow-width: 50px;
    --mod-actionbutton-icon-size: var(--spectrum-workflow-icon-size-100);
}

:host([size="s"]) {
    --sp-tabs-overflow-button-height: calc(var(--spectrum-tab-item-height-small) - var(--spectrum-border-width-200));
    --sp-tabs-overflow-button-size: var(--spectrum-tab-item-height-small);
    --mod-actionbutton-icon-size: var(--spectrum-workflow-icon-size-75);
}

:host([size="l"]) {
    --sp-tabs-overflow-button-height: calc(var(--spectrum-tab-item-height-large) - var(--spectrum-border-width-200));
    --sp-tabs-overflow-button-size: var(--spectrum-tab-item-height-large);
    --mod-actionbutton-icon-size: var(--spectrum-workflow-icon-size-200);
}

:host([size="xl"]) {
    --sp-tabs-overflow-button-height: calc(var(--spectrum-tab-item-height-extra-large) - var(--spectrum-border-width-200));
    --sp-tabs-overflow-button-size: var(--spectrum-tab-item-height-extra-large);
    --mod-actionbutton-icon-size: var(--spectrum-workflow-icon-size-300);
}

:host([compact]) {
    --sp-tabs-overflow-button-height: calc(var(--spectrum-tab-item-compact-height-medium) - var(--spectrum-border-width-200));
    --mod-actionbutton-icon-size: var(--spectrum-workflow-icon-size-50);
}

sp-action-button {
    width: var(--sp-tabs-overflow-button-size);
    height: var(--sp-tabs-overflow-button-height);
    position: absolute;
    z-index: 2;
    border: none;
    text-align: center;
    box-shadow: none;
    background: transparent;
    color: var(--sp-tabs-overflow-icon-color);
}

sp-action-button.left-scroll {
    visibility: hidden;
    left: var(--sp-tabs-overflow-previous-button-left);
}

sp-action-button.right-scroll {
    visibility: hidden;
    right: var(--sp-tabs-overflow-next-button-right);
}

sp-action-button.left-scroll.show,
sp-action-button.right-scroll.show {
    visibility: visible;
}

.tabs-overflow-container {
    position: relative;
}

/* styling for shadow behind the left and right buttons */
.tabs-overflow-container:before,
.tabs-overflow-container:after {
    content: "";
    visibility: hidden;
    position: absolute;
    z-index: 1;
    height: var(--sp-tabs-overflow-button-height);
    width: var(--sp-tabs-overflow-shadow-width);
    pointer-events: none;
    inset-block-start: 0;
}

.tabs-overflow-container:before {
    background: transparent linear-gradient(270deg, transparent, var(--sp-tabs-overflow-shadow-color)) 0 0 no-repeat padding-box;
    left: 0;
}

.tabs-overflow-container:after {
    background: transparent linear-gradient(90deg, transparent, var(--sp-tabs-overflow-shadow-color)) 0 0 no-repeat padding-box;
    right: 0;
}

.tabs-overflow-container.left-shadow:before,
.tabs-overflow-container.right-shadow:after {
    visibility: visible;
}
